import * as React from "react";
import BlogConstant from "../../util/BlogConstant";
import { WeaAuth } from "ecCom";
import { inject, observer } from "mobx-react";
import { toJS } from "mobx";
import { WeaLocaleProvider } from "ecCom";
const getLabel = WeaLocaleProvider.getLabel;

@inject("exportBlogListStore")
@observer
export default class AddExportPermissions extends React.Component {
  componentDidMount() {
    this.props.exportBlogListStore.getBlogBackstageExportAddCondition({dataType: 3});
  }

  render() {
    const { shareBaseDataType, addExportPermissions, setObjShow } = this.props.exportBlogListStore;
    const { showObj, objCondition } = toJS(shareBaseDataType);
    return (
      <div>
        <WeaAuth ecId={`${this && this.props && this.props.ecId || ''}_WeaAuth@ocxo9t`}
          icon={BlogConstant.dialogIcon}
          iconBgcolor={BlogConstant.iconBgColor}
          title={getLabel(84070,"添加权限")}
          visible={showObj}
          conditions={objCondition}
          onOk={data => {
            addExportPermissions({
              operation: "add",
              ...data
            });
          }}
          onCancel={() => setObjShow(false)}
        />
      </div>
    );
  }
}

